package com.tangmin.spring;/**
 * @ClassName SpringTest01
 * @Description 测试bean标签的init-method和destroy-method属性
 * @date 2021/9/17 18:08
 * @Version 1.0
 */

import com.tangmin.dao.UserDao;
import org.junit.Test;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * Spring-pom文件-Bean标签-Scope-singleton和prototype的区别
 *
 * @author YourName
 * @date 2021-09-17 18:08
 **/
public class UserDaoImplTest02 {
    @Test
    public void testShow(){
        ClassPathXmlApplicationContext app = new ClassPathXmlApplicationContext("applicationContext.xml");
        UserDao userDao1 = (UserDao)app.getBean("userDao");
        System.out.println(userDao1);
        //销毁容器，执行对象的销毁方法
        ((ClassPathXmlApplicationContext) app).close();
    }
}
